-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow specifying workflow id when starting the workflow #1942
Conversation
|
I am strongly against adding a |
My apologize, didn't mean to immediately close |
Thank you for the feedback.
To clarify my idea,
I see your point. I was wondering about it too, and ended up implementing it in a way where if @WorkflowId parameter is null, the ID is taken from WorkflowOptions thus facilitating a fallback to default mechanism. So, if a caller doesn't specify a workflow id (e.g. in a http request) then it can fall back to some pre-defined value. This could be made nicer with This is totally opt-in, if there is no parameter annotated with
For untyped stubs the original start() method is left unaffected. On one hand not breaking APIs is a good thing, also it just seemed easier to implement with a separate startWithId() method. |
My issue with adding |
I understand you left |
Ok thanks. I'll explore solving my needs with a wrapper class / utility function instead. |
What was changed
For now this is an experiment to gather feedback.
WorkflowStub
:WorkflowExecution startWithId(String workflowId, Object... args);
@WorkflowId
for a paramater on a@WorkflowMethod
WorkflowInvocationHandler
: if a@WorkflowId
is specified, start workflow withstartWithId()
Why?
Currently the
workflowId
can only be set inWorkflowOptions
, along with other options that are basically static config for a workflow instance, whereasworkflowId
differs typically between workflow executions.This makes injecting pre-configured workflow instances where they are to be started virtually impossible, which adds noise to the call site. With this new API, such code becomes possible (spring-like pseudo-code). The idea is that ExampleWorkflowImpl could be created by an IOC container for each request (e.g. in spring Request scope).
Checklist
Closes: N/A
How was this tested: With the added junit tests
Any docs updates needed? Probably, as this is a public API addition.